<%@page import="com.google.appengine.api.blobstore.BlobKey"%>
<%@page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory"%>
<%@page import="com.google.appengine.api.images.ImagesServiceFactory"%>
<%@page import="com.google.appengine.api.images.ImagesService"%>
<%@page import="com.google.appengine.api.blobstore.BlobstoreService"%>
<%@page import="entities.User"%>
<%
User user = (User) request.getAttribute("user_logged_in");
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
ImagesService imagesService = ImagesServiceFactory.getImagesService();
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<% if (user != null) { %>
							<h3 class="blockHeading"><span>My Dashboard</span></h3>
                            <div class="content-center">
                            	<div style="width: 120px; height: 120px; border: 2px solid red; margin: 0 auto;">
                            		<% 
									if (user.getAvatar() != null && !user.getAvatar().isEmpty())  {
										 BlobKey blobKey = new BlobKey(user.getAvatar());
									%>
									<img src="<%=imagesService.getServingUrl(blobKey) %>=s120-c" alt="avatar"> 
									<% } else { %>							
									<img src="/images/no_avatar.gif" alt="Author Image"  />
									<% } %>
                            	</div>
                            </div>
                            <ul>
                            	<li><a href="/profile">Home</a></li>
                            	<li><a href="/profile/change-avatar">Change avatar</a></li>
                                <li><a href="/profile/change">Change profile</a></li>
                                <li><a href="/logout">Logout</a></li>
                            </ul>
                            <h3 class="title">Profile</h3>
<% } %>